package com.iweipan.view;

import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.text.TextPaint;
import android.text.style.ClickableSpan;
import android.view.View;
import android.widget.Toast;

/**
 * Created by Administrator on 2016/11/10.
 */

public class PeopleClickableSpan extends ClickableSpan {
    String string;
    Context context;
    Class<?> aClass;

    public PeopleClickableSpan(String str, Context context, Class<?> aClass) {
        super();
        this.string = str;
        this.context = context;
        this.aClass = aClass;
    }


    @Override
    public void updateDrawState(TextPaint ds) {
        ds.setColor(Color.rgb(66,157,227));
    }


    @Override
    public void onClick(View widget) {
        try {
            Intent intent
                    = new Intent();
            intent.setClass(context, aClass);
            context.startActivity(intent);
        } catch (Exception e) {
            Toast.makeText(context, "e:" + e, Toast.LENGTH_SHORT).show();
        }


    }
}
